﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <script src="~/js/frame.js"></script>
</head>
<body>
    <div class="framecontainer">
        <div class="panel">
            <div class="panel-header ">
                <div class="panel-title">附件库管理</div>
            </div>
            <div class="panel-body">
                <div class="listcontainer">
                    <div class="searchop">
                        <div class="btnop">
                            <button class="btn btn-op" type="button" onclick="OpenAdd()"><span class="btntext">新增附件库</span></button>
                            <button class="btn btn-op" type="button" onclick="BatchDelete()"><span class="btntext">批量删除</span></button>
                        </div>
                        <div class="btnop">
                            <input id="ConfigName" type="text" class="form-control searchinput" placeholder="请输入附件库名称">
                            <button class="btn" type="button" onclick="BindGrid()"><i class="icon icon-search"></i><span class="searchtext">查询</span></button>
                        </div>
                    </div>
                    <div class="tableop">
                        <table class="GridStyle" id="CloudGrid" keyid="ConfigGuid" url="oplist" relationpageid="cloudpagination" otherparm="SearchParm" afterbind="AfterBindData">
                            <tr class="HeaderStyle">
                                <th scope="col" style="width: 10px;" field="check" rowalign="center"></th>
                                <th scope="col" style="width: 10px;" field="index" rowalign="center">序</th>
                                <th scope="col" style="width: 200px;" field="ConfigName" rowalign="left">连接名称</th>
                                <th scope="col" field="ConfigConnectionString" rowalign="left">连接字符串</th>
                                <th scope="col" style="width: 200px;"  field="ConfigInfo" rowalign="left">备注</th>
                                <th scope="col" style="width: 100px;" field="function" functionname="GetConfigStaus" rowalign="center">状态</th>
                                <th scope="col" style="width: 50px;" field="SortNum" rowalign="center">排序</th>
                                <th scope="col" style="width: 50px;" field="EditButton" functionname="GridEdit" rowalign="center">详细</th>
                            </tr>
                        </table>
                    </div>
                    <div class="bottomop">
                        <div class="pageop">
                            <ul class="pagination" id="cloudpagination"></ul>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <script>
        $(function () {
            BindGrid();
        })
        function BindGrid() {
            BindCloudGrid($("#CloudGrid"))
        }

        function SearchParm() {
            return {
                "ConfigName": $("#ConfigName").val(),
            };
        }
        function AfterBindData() {

        }
        function OpenAdd() {
            OpenTopDialog("新增附件库", "frame/base/attachconfig/add", 400, 800, BindGrid)
        }
        function BatchDelete() {
            var SelectRows = CloudGridChecked($("#CloudGrid"));
            if (SelectRows.length > 0) {
                OpenConfirm("确认删除选中的数据？", function () {
                    CloudPost({ "KeyID": SelectRows }, "opbatchdelete", function (res) {
                        if (res.code == 0) {
                            OpenSuccess("删除成功！", function () {
                                BindGrid();
                            })
                        } else {
                            OpenFail(res.data);
                        }
                    })
                })
            }
        }
        function GridEdit(RowData) {
            OpenTopDialog("编辑", "frame/base/attachconfig/edit?configguid=" + RowData.ConfigGuid, 400, 800, BindGrid)
        }
        function GetConfigStaus(RowData) {
            if (RowData.Enable == 100) {
                return "<span>启用</span>";
            } else {
                return "<span>禁用</span>";
            }
        }
    </script>
</body>
</html>
